Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: Stack Clear...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 15 of 18 Topic 4486 of 4860
Post > Topic >>

Re: Stack Clearing (win32)

by Cranky <spamtrap@[EMAIL PROTECTED] > Jan 14, 2008 at 10:06 PM

On Jan 15, 11:16 am, ArarghMail801NOSPAM <spamt...@[EMAIL PROTECTED]
> wrote:
> AFAIK, all windows APIs take parameters only in multiples of 4 bytes.
>
> So, both bytes(8) & words(16) are expanded to longs(32) prior to being
> pushed.  I think that this is being done partly to keep the stack
> dword(32) aligned.
>
> 0102A                       htons           proc    near
> 0102A  0F B7 4C 24 04                     movzx   ecx,word ptr [esp+4]
> 0102F  8B C1                                mov     eax,ecx
> 01031  33 D2                                xor     edx,edx
> 01033  C1 E8 08                             shr     eax,8
> 01036  8A F1                                mov     dh,cl
> 01038  0B C2                                or      eax,edx
> 0103A  C2 0004                              retn    4
>                             htons           endp

A little OT but you could also just not call htons and do it
yourself ;-)

    mov ax,100        ;****t number ?
    xchg ah,al        ;ax=network byte order

--
Cranky
 




 18 Posts in Topic:
Stack Clearing (win32)
"bwaichu@[EMAIL PROT  2008-01-14 17:37:50 
Re: [Clax86list] Stack Clearing (win32)
Charles Crayne <spamt  2008-01-14 19:59:16 
Re: Stack Clearing (win32)
ArarghMail801NOSPAM <s  2008-01-14 22:16:39 
Re: Stack Clearing (win32)
(Stephen Pelc) <spamtr  2008-01-15 09:19:32 
Re: Stack Clearing (win32)
ArarghMail801NOSPAM <s  2008-01-15 15:59:29 
Re: Stack Clearing (win32)
Spoon <root@[EMAIL PRO  2008-01-16 11:25:27 
Re: Stack Clearing (win32)
ArarghMail801NOSPAM <s  2008-01-16 18:04:34 
Re: Stack Clearing (win32)
Spoon <root@[EMAIL PRO  2008-01-17 14:26:25 
Re: Stack Clearing (win32)
ArarghMail801NOSPAM <s  2008-01-17 15:16:03 
Re: Stack Clearing (win32)
Tim Roberts <spamtrap  2008-01-18 04:48:17 
Re: Stack Clearing (win32)
ArarghMail801NOSPAM <s  2008-01-18 05:42:08 
Re: Stack Clearing (win32)
Tim Roberts <spamtrap  2008-01-20 05:54:37 
Re: Stack Clearing (win32)
ArarghMail801NOSPAM <s  2008-01-20 03:39:08 
Re: Stack Clearing (win32)
"bwaichu@[EMAIL PROT  2008-01-14 20:08:14 
Re: Stack Clearing (win32)
Cranky <spamtrap@[EMA  2008-01-14 22:06:29 
Re: Stack Clearing (win32)
Frank Kotler <spamtra  2008-01-15 07:20:19 
Re: Stack Clearing (win32)
ArarghMail801NOSPAM <s  2008-01-15 02:09:14 
Re: Stack Clearing (win32)
Alex Buell <spamtrap@  2008-01-21 02:03:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Nov 20 20:39:43 CST 2008.