News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Test Junk

Started by MichaelW, May 19, 2012, 02:59:13 AM

Previous topic - Next topic

MichaelW


;==============================================================================
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
Well Microsoft, here's another nice mess you've gotten us into.

jj2007

Not bad for a noob with only one post, MichaelW ;)

0
1
2
3
4
5
6

Press any key to continue ...

Daydreamer

time to show my first upload

Tedd

Needs more garlic..
Potato2

x64Core

#4
the attached files just can be download if one is user :P
Nice forum, goo MASM!  :biggrin:

Adamanteus

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:

Vortex

Return of The Jedi 8)

Antariy

"Was Marilyn Monroes a redhead, brunette or blonde assembly programmer ?:"

:lol

Greenhorn

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
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

hutch--

 :biggrin:

> (german pun: average = durchschnitt = cut through/intersect)  :greenclp:


Don57

Well I guess were all new members now


dedndave

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)

Antariy

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