Click here to Skip to main content
15,893,381 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to Resize Dialogbar? Pin
chaau21-Oct-12 15:06
chaau21-Oct-12 15:06 
QuestionUsing C++ codes in C# program ? Pin
taibc19-Oct-12 23:26
taibc19-Oct-12 23:26 
AnswerRe: Using C++ codes in C# program ? Pin
jschell20-Oct-12 4:43
jschell20-Oct-12 4:43 
GeneralRe: Using C++ codes in C# program ? Pin
taibc20-Oct-12 17:30
taibc20-Oct-12 17:30 
AnswerRe: Using C++ codes in C# program ? Pin
taibc22-Oct-12 0:32
taibc22-Oct-12 0:32 
GeneralRe: Using C++ codes in C# program ? Pin
Richard MacCutchan22-Oct-12 1:22
mveRichard MacCutchan22-Oct-12 1:22 
QuestionHow to keep track when a dialog is invoked second time.? Pin
mbatra3118-Oct-12 23:53
mbatra3118-Oct-12 23:53 
AnswerRe: How to keep track when a dialog is invoked second time.? Pin
Sivaraman Dhamodharan19-Oct-12 0:07
Sivaraman Dhamodharan19-Oct-12 0:07 
GeneralRe: How to keep track when a dialog is invoked second time.? Pin
mbatra3119-Oct-12 0:12
mbatra3119-Oct-12 0:12 
AnswerRe: How to keep track when a dialog is invoked second time.? Pin
Jochen Arndt19-Oct-12 0:31
professionalJochen Arndt19-Oct-12 0:31 
AnswerRe: How to keep track when a dialog is invoked second time.? Pin
ThatsAlok19-Oct-12 2:03
ThatsAlok19-Oct-12 2:03 
AnswerRe: How to keep track when a dialog is invoked second time.? Pin
Sajeesh Payolam19-Oct-12 20:51
Sajeesh Payolam19-Oct-12 20:51 
QuestionHow to use a png or jpg in visual studio? Pin
DanYELL18-Oct-12 16:12
DanYELL18-Oct-12 16:12 
AnswerRe: How to use a png or jpg in visual studio? Pin
Santhosh G_18-Oct-12 20:17
Santhosh G_18-Oct-12 20:17 
Question[Solved] How to Call an x86 3+ Parameter Method Using __fastcall Calling Conentions Pin
Skippums18-Oct-12 12:38
Skippums18-Oct-12 12:38 
AnswerRe: How to Call an x86 3+ Parameter Method Using __fastcall Calling Conentions Pin
Richard MacCutchan18-Oct-12 23:18
mveRichard MacCutchan18-Oct-12 23:18 
GeneralRe: How to Call an x86 3+ Parameter Method Using __fastcall Calling Conentions Pin
Skippums19-Oct-12 7:07
Skippums19-Oct-12 7:07 
On the page you quoted, it says "C and C++ function arguments are usually passed on the stack". This is if you are using the cdecl or stdcall calling conventions (all arguments are pushed to the stack, but they vary in who is responsible for clean-up). I am attempting to use the fastcall calling convention, where the first two parameters are passed in ECX and EDX, respectively, and all remaining parameters are pushed to the stack right-to-left. Confirmation of this can be found on MSDN[^]

When I actually run in the debugger, the stack pointer register (ESP) is pointing to the return value (pushed from EIP, the program execution pointer, after my third parameter is pushed), with [ESP + 4] (the second item in the stack) being my third parameter. When using fastcall, the callee is responsible for removing the parameters from the stack. However, I currently have to swap the two arguments on the stack (at addresses [ESP] and [ESP + 4]), otherwise I pop the return address off the stack, then try to return to address 3 when the RET statement executes.

This seems counter-intuitive to me. Why should I have to swap the stack arguments? Is there some other way to do this where I don't have to swap the arguments?
Sounds like somebody's got a case of the Mondays

-Jeff

GeneralRe: How to Call an x86 3+ Parameter Method Using __fastcall Calling Conentions Pin
Richard MacCutchan19-Oct-12 22:23
mveRichard MacCutchan19-Oct-12 22:23 
QuestionUsing Make - text books / references wanted Pin
Vaclav_18-Oct-12 4:47
Vaclav_18-Oct-12 4:47 
AnswerRe: Using Make - text books / references wanted Pin
Richard MacCutchan18-Oct-12 7:10
mveRichard MacCutchan18-Oct-12 7:10 
GeneralRe: Using Make - text books / references wanted Pin
Vaclav_18-Oct-12 7:31
Vaclav_18-Oct-12 7:31 
GeneralRe: Using Make - text books / references wanted Pin
Chris Meech18-Oct-12 8:03
Chris Meech18-Oct-12 8:03 
GeneralRe: Using Make - text books / references wanted Pin
Richard MacCutchan18-Oct-12 23:07
mveRichard MacCutchan18-Oct-12 23:07 
GeneralRe: Using Make - text books / references wanted Pin
Richard MacCutchan18-Oct-12 23:00
mveRichard MacCutchan18-Oct-12 23:00 
AnswerRe: Using Make - text books / references wanted Pin
jschell18-Oct-12 9:31
jschell18-Oct-12 9:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.