i had written this in one of my programs: invoke htons, ax i wrote ax because the Win32 API ref said the function took a 16bit number as argument. the above works on win95/98/98SE/ME but not on win2k. took me ages to spot that bug i'd tell ya!! now with invoke htons, eax im back on track ;)
Does ME/98SE (and downgraders) support invoke htons,eax?
High, I use invoke htons,eax without any problem on Win98SE and Win2k. The function return value is a word in ax. Am I wrong ? Test
Nope, just checked it too. I used dword's too... Zynaps, dude! You better not get me off track or else ... erm.. d*mn! Where did that trout go? ;D
winsock will use only the lower 16-bit value: that's the interpretation of the C function prototype. But in practice, you have to push a dword on the stack: winsock will ignore the high word. I used to have exactly the same problem when I started winsock programming. I had to debug to see the code generated for pushing a 16-bit value on the stack. It' s ugly: MASM took the liberty to correct it for me but it did so with the wrong assumption. "invoke htons,ax" is transformed into:
push 00 ; 1 dword pushed on the stack push ax ; 1 word pushed on the stack call htons