News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Passing a structure

Started by Biterider, March 22, 2019, 05:36:44 AM

Previous topic - Next topic

nidud

#15
deleted

LiaoMi

Quote from: AW on March 28, 2019, 07:05:10 AM
I have checked MASM and MSVC for the 32-bit case and 3 byte strutures.
There is indeed a bug in MASM when using invoke with the 3 byte structure.
On the other hand MSVC handles well the situation, it does not makes 2 pushes totaling 8 bytes, it reserves 4 bytes in the stack through "sub esp" and puts the structure there by moving 1 byte more 1 word. The receiving end knows how to pick it correctly.

Not a bug but a feature :biggrin: we can create a good support request  :eusa_boohoo:

aw27

I made a report to Microsoft and am ready to wait 5 years for the fix.  ::)

https://developercommunity.visualstudio.com/content/problem/508122/masm-invoke-with-a-3-byte-struct.html

jj2007

Personally, I would never use a 3-byte structure; add one padding byte, and everything works fine. Anyway, here's a testbed for 32-bit Masm:
include \masm32\include\masm32rt.inc

S3 STRUCT
x0 db ?
x1 db ?
x2 db ?
; x3 db ?    ; uncomment, and it will work just fine
S3 ENDS

.data
s3b S3 <1, 2, 3>

.code
s3Test proc s3passed:S3
  lea edx, s3passed
  print hex$(edx), " is the address", 13, 10
  movzx eax, s3passed.x0
  print str$(eax), " = x0", 13, 10
  movzx eax, s3passed.x1
  print str$(eax), " = x1", 13, 10
  movzx eax, s3passed.x2
  print str$(eax), " = x2", 13, 10
  ret
s3Test endp

start:
;   int 3
  invoke s3Test, s3b ; UAsm: Error A2049: Invalid instruction operands
  inkey "buggy indeed"
  exit

end start

OPT_Assembler mlv14 ; no complaints but there is a FAT BUG

0040102B      ³.  A0 02204000       mov al, [402002] ; the S3 starts at 402000
00401030      ³.  66:50             push ax
00401032      ³.  66:FF35 02204000  push word ptr [402002]
00401039      ³.  E8 C2FFFFFF       call 00401000

aw27

I got a reply from an MSFT (Microsoft Fuzzy Technician):
"Need More Info" and added a comment.Thank you for your feedback! For us to investigate this further, could you please provide more details like reproducing steps about this issue and example issue code.we don't know how to reproduce this issue on my side as current description. We look forward to hearing from you!

They never understand on a first approach, we need to be patient.  :biggrin:

jj2007

Give him my testbed, it shows the issue crystal clear. Of course, Fuzzy himself has never touched Masm, but there must be somebody at M$ who has coded some lines in assembly. I hope so, at least. There are rumours that compiler developers use assemblers.

Biterider

Hi
Point them to this topic. At least our forum can gain some attention on Redmond.
Biterider

aw27

Quote from: jj2007 on March 29, 2019, 07:18:00 PM
Give him my testbed, it shows the issue crystal clear.
You can post your testbed but you will need to explain to them what the macros do with examples and documentation.

Quote from: Biterider on March 29, 2019, 09:20:15 PM
Point them to this topic.
:badgrin:

LiaoMi

Quote from: AW on March 29, 2019, 06:04:26 PM
I got a reply from an MSFT (Microsoft Fuzzy Technician):
"Need More Info" and added a comment.Thank you for your feedback! For us to investigate this further, could you please provide more details like reproducing steps about this issue and example issue code.we don't know how to reproduce this issue on my side as current description. We look forward to hearing from you!

They never understand on a first approach, we need to be patient.  :biggrin:

They want a ready-made binary file to keep their heads off, so that in their free time they can play Sony PlayStation, in previous topics it was all the same  :eusa_clap:

aw27

Quote from: LiaoMi on March 30, 2019, 01:14:44 AM
They want a ready-made binary file to keep their heads off, so that in their free time they can play Sony PlayStation, in previous topics it was all the same  :eusa_clap:
Everything works like in a big hospital.
They have a Triage at the entrance that establish priorities and forward the complaints to Areas.
Each Area has a receptionist, like the Fuzzy guy that replied to me. He knows nothing about the problem or how o solve it, but must write a summary of the symptoms  and address the file to the specialist doctor.

TimoVJL

Person or PC, at least makes same mistakes ;)
compare to this

So next reply is
QuoteThank you for your feedback! Unfortunately, right now we don't have enough information to investigate this issue and find a solution. If this is still an issue for you, please update to our latest version. If you are still able to repro it, please provide us with more info!

BTW:Lin Gao [MSFT]
Reputation 27
Posts 142
Following 0
Followers 0
Joined 11/18
May the source be with you

aw27

Let's see what come next,  8):
Thanks for taking the time to report this issue to us. We've filed a bug for this issue on the C++ team here. The status on this Developer Community item will be updated as that bug is looked at. Thanks again for reporting this to us.

LiaoMi

Quote from: AW on April 01, 2019, 11:16:33 PM
Let's see what come next,  8):
Thanks for taking the time to report this issue to us. We've filed a bug for this issue on the C++ team here. The status on this Developer Community item will be updated as that bug is looked at. Thanks again for reporting this to us.

Great news! Thank you AW! Artificial intelligence could talk to us, suddenly asked where to get this little-known msvcrt.lib library :biggrin:.

aw27

Quote from: LiaoMi on April 02, 2019, 06:58:10 AM
Great news! Thank you AW! Artificial intelligence could talk to us, suddenly asked where to get this little-known msvcrt.lib library :biggrin:.

Hi LiaoMi,
msvcrt.lib is a problem these days. "Weird, my msvcrt.lib doesn't export printf... "
But I could not tell the MickeySoft representative to download the MASM32 SDK and have a msvcrt.lib with printf, they wouldn't use 3rd party generated libraries.
So, I built a VS 2017 project and put there as input the 3 libs required nowadays (since VS 2015) to produce a printf. Apparently it worked.  :biggrin:

TimoVJL

But they can create one:; lib.exe -DEF:msvcrt-os.def -OUT:msvcrt-os.lib
; link.exe -lib -DEF:msvcrt-os.def -OUT:msvcrt-os.lib
LIBRARY msvcrt.dll
EXPORTS
printf
May the source be with you