No, after properly defining the function, (ie saying to use stdcall) i founddelphi wasn't balancing the stack properly on return of this function. Now after no poking around with windbg, i was able to determine, it wasn't balancing it by 4bytes. WTF!
How can something not balence by 4bytes, thats not some small acidental error on my part in the way i defined the funciton, thats pure borland logic error.
Umm, considering how few problems Delphi seems to have calling .DLLs in general, I'd say the trouble is actually in your call translation. One of three possibilities:
* Forgot to make it a function (even if you never use the result, prototyping it as procedure instead of function will cause a stack problem (most missing ones I see are forgetting to return an HRESULT)
* Using or not using const, var or out
* One of the parameters is prototyped incorrectly (especially with strings and long strings)
GCC and MSVC often add a few lines of "padding" between functions as NOPs but these NEVER get executed, they are just there as overhead from linking.
If you ever manage to get a Delphi compile with symbols on, you'd find out that all those 'stupid-looking instructions' like MOV EAX, EAX are actually padding for 32-bit alignment - they occur after the RET and before the entry point of the next . I don't know why they don't use NOP, but it looks like they're trying to use no-effect instructions that take up a single line in a CPU view (NOP for a pad of 1 byte, MOV EAX,EAX for a pad of 2 bytes, and LEA EAX,[EAX+0x0] for 3 bytes).