# How can an IA-32 program seemingly compiled with MSVC send its sole argument via EAX? [duplicate]

A C++ program I'm looking at appears to have been compiled with MSVC. It links to MSVCR100.dll, contains MSVC's security cookie code and uses the Microsoft mangling scheme. However, one of the functions I've hit sends its only argument in the EAX register, which is immediately passed as an argument to LoadLibraryW (after BP frame initialisation).

Looking at the code, there are sequences and strings referenced in other functions (evidence of inlining), so I don't think it's a direct assembly code job.

To my knowledge and according to my sources, MSVC doesn't have a calling convention that sends arguments via EAX. Watcom and Delphi have options, but not MSVC. Is it possible that the compiler optimised the function into a register call? Or is there another, undocumented calling convention in MSVC?

• we can't see your screen from here, so show the code! – Igor Skochinsky Dec 5 '17 at 8:50
• next time just edit the original question instead of posting a new one – Igor Skochinsky Dec 7 '17 at 15:33
• @IgorSkochinsky I felt that the new information changed the nature of the original question enough to warrant a new question. – Ben Jaguar Marshall Dec 7 '17 at 20:37