did you know that hotns api on win98 can work if you pass it WORD as parametar, but on XP it will only work if you pass it DWORD?

yeah it took me a few days and a lot of headche to find this bug which is not soupose to be a bug, since short should be always WORD.....damn billy
Posted on 2002-11-14 21:20:15 by Mikky
If you needed to pass the parameter as a 'DWORD' in Windows/XP
and 'WORD' in Windows/98. This would resort in compatibility problems
for alot of winsock related software.

MSDN:"The htons function takes a 16-bit number in host byte order and
returns a 16-bit number in network byte order used in TCP/IP networks."

Wouldn't Microsoft tell the programmers that they infact changed the whole
winsock 'htons' api call in Windows/XP? ( I would like to think so ) :alright:
Posted on 2002-11-15 03:13:06 by natas
All parameters to API functions (or any stdcall/C function for that matter) are passed as dwords. If you need to pass a byte or word you extend it to a dword (just only use a lower part of the dword), and pass it on.

Posted on 2002-11-15 03:51:12 by Thomas
well problem was that I used WORD as parametar and I was programming under 98se, now after I gave source to buddy with XP he complained that there is bug but we could found one
later he found out that

invoke htons, 80 ; works
mov Port,80
invoke htons,Port ; doesnt work, Port is dword

that was a little clue that help us to solve this bug case
Posted on 2002-11-15 16:00:55 by Mikky