The MASM Forum

General => The Campus => Topic started by: MichaelW on May 19, 2012, 02:59:13 AM

Title: Test Junk
Post by: MichaelW on May 19, 2012, 02:59:13 AM

;==============================================================================
include \masm32\include\masm32rt.inc
;==============================================================================
.data
.code
;==============================================================================
testproc proc C args:VARARG
    xor eax, eax                ; assume zero args
    mov edx, [ebp+4]            ; get return address
    cmp WORD PTR[edx], 0C483h   ; opcode for add esp,n
    je  @F
    ret
  @@:
    movzx eax, BYTE PTR[edx+2]  ; get value added to esp
    shr eax, 2                  ; divide by 4 for arg count
    ret
testproc endp
;==============================================================================
start:
;==============================================================================
    invoke testproc
    printf("%d\n",eax)
    invoke testproc,1
    printf("%d\n",eax)
    invoke testproc,1,2
    printf("%d\n",eax)
    invoke testproc,1,2,3
    printf("%d\n",eax)
    invoke testproc,1,2,3,4
    printf("%d\n",eax)
    invoke testproc,1,2,3,4,5
    printf("%d\n",eax)
    invoke testproc,1,2,3,4,5,6
    printf("%d\n\n",eax)
    inkey
    exit
;==============================================================================
end start
Title: Re: Test Junk
Post by: jj2007 on May 21, 2012, 01:48:49 AM
Not bad for a noob with only one post, MichaelW ;)

0
1
2
3
4
5
6

Press any key to continue ...
Title: Re: Test Junk
Post by: Daydreamer on May 21, 2012, 04:30:00 AM
time to show my first upload
Title: Re: Test Junk
Post by: Tedd on May 21, 2012, 04:31:01 AM
Needs more garlic..
Title: Re: Test Junk
Post by: x64Core on May 21, 2012, 05:52:19 AM
the attached files just can be download if one is user :P
Nice forum, goo MASM!  :biggrin:
Title: Re: Test Junk
Post by: Adamanteus on May 21, 2012, 06:16:43 AM
That to upload nice examples and I'll join, so hows singing grands on russian TV now - comon and dance  :t
For example allowed only C calling convensions and stayed to call func(va_list, int) - maybe samewere will be need - unknown  :eusa_boohoo:
My first upload (last from now) to here is on my site - it's driven for any errors Test_GM.exe (G-Lib program example). If somebody will hang it even by WinAPI-hook, I'll appriciate - so could post to me  :dazzled:
Title: Re: Test Junk
Post by: Vortex on May 21, 2012, 06:39:25 AM
Return of The Jedi 8)
Title: Re: Test Junk
Post by: Antariy on May 21, 2012, 10:24:15 AM
"Was Marilyn Monroes a redhead, brunette or blonde assembly programmer ?:"

:lol
Title: Re: Test Junk
Post by: Greenhorn on May 21, 2012, 05:40:04 PM
Hi Sirs,

nice new forum.  :t

At first I thought "How many legs does the average horse have ?" was a catch-22 until I checked that the input wants a number and not a word.
btw, doesn't an average horse have just two legs ???
(german pun: average = durchschnitt = cut through/intersect)


Regards
Greenhorn
Title: Re: Test Junk
Post by: hutch-- on May 21, 2012, 05:54:10 PM
 :biggrin:

> (german pun: average = durchschnitt = cut through/intersect)  :greenclp:
Title: Re: Test Junk
Post by: brixton on May 22, 2012, 06:24:17 AM
Quote from: Antariy on May 21, 2012, 10:24:15 AM
:eusa_dance:
Title: Re: Test Junk
Post by: Don57 on May 23, 2012, 05:58:36 AM
Well I guess were all new members now
Title: Re: Test Junk
Post by: Antariy on May 23, 2012, 07:16:11 AM
Quote from: brixton on May 22, 2012, 06:24:17 AM
Quote from: Antariy on May 21, 2012, 10:24:15 AM
:eusa_dance:

:biggrin:
Title: Re: Test Junk
Post by: dedndave on May 23, 2012, 10:48:42 PM
Quote from: Antariy on May 23, 2012, 07:16:11 AM
Quote from: brixton on May 22, 2012, 06:24:17 AM
Quote from: Antariy on May 21, 2012, 10:24:15 AM
:eusa_dance:

i had to see what it would look like   :biggrin:

it's like the mirrors in the movie "Inception"   :P
(except without the little cutie pie Ellen Page)
Title: Re: Test Junk
Post by: Antariy on May 24, 2012, 12:16:42 PM
Quote from: dedndave on May 23, 2012, 10:48:42 PM
Quote from: Antariy on May 23, 2012, 07:16:11 AM
Quote from: brixton on May 22, 2012, 06:24:17 AM
Quote from: Antariy on May 21, 2012, 10:24:15 AM
:eusa_dance:

i had to see what it would look like   :biggrin:

it's like the mirrors in the movie "Inception"   :P
(except wi... nBbΓΘ"≤▬☺îy►τ■Z▲2⌂ä∟⌡╞.3╜


SMF_EXCEPTION_CRASH_DUMP:
00000000  49 54 20 49  53 20 54 4F  4F 4F 4F 20  44 45 45 50  IT IS TOOOO DEEP
00000010  20 52 45 43  55 52 53 49  4F 4E 2C 20  44 41 56 45   RECURSION, DAVE
Title: Re: Test Junk
Post by: dedndave on May 24, 2012, 01:47:19 PM
oops !!!   :redface:

(http://mintywhite.com/images/wg/0904/logmein-infinite01.png)