The MASM Forum

Miscellaneous => The Orphanage => Topic started by: Magnum on December 15, 2012, 06:31:46 AM

Title: Challenge ?
Post by: Magnum on December 15, 2012, 06:31:46 AM
Is anyone besides Dave interested in a challenge ?

Andy
Title: Re: Challenge ?
Post by: Gunther on December 15, 2012, 09:20:19 AM
What kind of challenge?

Gunther
Title: Re: Challenge ?
Post by: Tedd on December 18, 2012, 01:24:00 AM
Is the challenge to guess what the challenge is?
Title: Re: Challenge ?
Post by: Magnum on December 18, 2012, 01:57:11 AM
Will get back to you Tedd.

I am very busy.

Andy
Title: Re: Challenge ?
Post by: Magnum on December 23, 2012, 01:15:30 AM
Challenge is attached.

I have looked at it previously in Olly and IDA.

Open it in a debugger.

What is it doing ?

Try to produce a source code capable of being assembled by masm.

Andy
Title: Re: Challenge ?
Post by: jj2007 on December 23, 2012, 01:51:14 AM
Looks like a Christmas present, Andy - I will open it on 24th :icon_mrgreen:
Title: Re: Challenge ?
Post by: Magnum on December 23, 2012, 03:01:06 AM
Ich ersetzte einen String mit einem mit Weihnachten in der Zeichenkette.

Ich will nicht, um es zu einfach.

Sprischt du mit Ihnen später.

Es tut mir leid meine Grammatik ist schlecht

Andy

Title: Re: Challenge ?
Post by: qWord on December 23, 2012, 05:01:48 AM
Copy & Paste from a Dissasmbler or Debugger is surely no challenge for anyone here :t
Title: Re: Challenge ?
Post by: Magnum on December 23, 2012, 05:22:43 AM
Can we see what you come up with that will assembly with masm ?

Title: Re: Challenge ?
Post by: Tedd on December 24, 2012, 05:49:19 AM
This wasn't a 'challenge,' it was an attempt at getting someone else to do what you apparently couldn't. Don't try to pass it off as anything else.

It took 5 minutes, and a little longer to make it pretty. It's just standard exception handling code - there's nothing particularly interesting. And you could learn much more effectively through research rather than trying to hack away at code you don't really understand.
Try http://www.microsoft.com/msj/0197/Exception/Exception.aspx (http://www.microsoft.com/msj/0197/Exception/Exception.aspx)


For what it's worth (not a whole lot):

.586
.model flat, stdcall
option casemap:none
include windows.inc
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib

;***************************************************************************************************

.const
msg1        db "abcdefgh",0
msg2        db "           ",0
msg3        db "merry christmas",0

.code
ALIGN 16
exception_handler proc C pExceptionRecord:PTR EXCEPTION_RECORD,EstablisherFrame:DWORD,pContext:PTR CONTEXT,DispatcherContext:DWORD
    LOCAL vara[40h]:BYTE
    push ebx
    push esi
    push edi

    mov eax,pExceptionRecord
    cmp DWORD PTR [eax],80000003h
    jne @out

    mov ecx,pContext
    mov edx,[ecx+0B8h]
    add edx,1
    mov eax,pContext
    mov [eax+0B8h],edx

    invoke MessageBox, NULL,ADDR msg1,ADDR msg2,MB_OK
    invoke ExitProcess, 0

  @out:
    xor eax,eax
    pop edi
    pop esi
    pop ebx
    ret
exception_handler endp

ALIGN 16
start:
main proc C
    LOCAL vara[40h]:BYTE
    push ebx
    push esi
    push edi

    assume fs:nothing   
    push OFFSET exception_handler
    push DWORD PTR fs:[0]
    mov fs:[0],esp

    invoke RaiseException, 80000003h,EXCEPTION_CONTINUABLE,1,NULL

    pop fs:[0]
    pop eax
    assume fs:error

    invoke MessageBox, NULL,ADDR msg3,ADDR msg2,MB_OK

    pop edi
    pop esi
    pop ebx
    ret
main endp

;***************************************************************************************************
end start
Title: Re: Challenge ?
Post by: Magnum on December 24, 2012, 06:23:59 AM
It was posted because I found it interesting and thought others might also.

You jumped to conclusions.

Andy