Click here to Skip to main content
15,918,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: problem in running an application Pin
MailtoGops22-Aug-05 5:42
MailtoGops22-Aug-05 5:42 
Generalerror LNK2001 Pin
valerie9918-Aug-05 11:14
valerie9918-Aug-05 11:14 
GeneralRe: error LNK2001 Pin
Graham Bradshaw18-Aug-05 12:08
Graham Bradshaw18-Aug-05 12:08 
GeneralThank you!!! Pin
valerie9919-Aug-05 4:11
valerie9919-Aug-05 4:11 
GeneralRe: error LNK2001 Pin
sunit518-Aug-05 18:56
sunit518-Aug-05 18:56 
Generalyeah! so true! Pin
valerie9919-Aug-05 4:12
valerie9919-Aug-05 4:12 
Generalquestion related to drivers Pin
gamitech18-Aug-05 10:09
gamitech18-Aug-05 10:09 
General__stdcall Pin
Anton Mikhalyov18-Aug-05 8:09
Anton Mikhalyov18-Aug-05 8:09 
I don't understand why compiler(Microsoft Visual C++ 7.1) always makes code that cleans stack from parameters after execution function that declared as __stdcall:

void corrupt {
typedef HANDLE (__stdcall *FOO)(...); // function must be called via std convention
FOO foo = (FOO)GetProcAddress(LoadLibrary("kernel32.dll"), "GetModuleHandleA");
(*foo)(NULL);
}

Disassembly:
push offset foo.??_C@_0BB@HNEJOH> ; /ProcNameOrdinal = "GetModuleHandleA"
push offset foo.??_C@_0N@MDJJJHM> ; |/FileName = "kernel32.dll"
call near dword ptr ds:[<&KERNEL32.LoadLibraryA> ; |\LoadLibraryA
push eax ; |hModule = 0012F34C
mov edi, dword ptr ds:[<&KERNEL32.GetProcAddress> ; |kernel32.GetProcAddress
call near edi ; \GetProcAddress
push 0
call near eax ; GetModuleHandleA call
add esp, 4 ; An unwanted stack clean

After execution this function we'll see an access violation, because the return address will be wrong.
How can I fix that problem?

PS In project options __stdcall is default calling convention
GeneralRe: __stdcall Pin
Chris Losinger18-Aug-05 8:33
professionalChris Losinger18-Aug-05 8:33 
GeneralRe: __stdcall Pin
Anton Mikhalyov18-Aug-05 17:55
Anton Mikhalyov18-Aug-05 17:55 
GeneralRe: __stdcall Pin
MailtoGops19-Aug-05 4:14
MailtoGops19-Aug-05 4:14 
GeneralRe: __stdcall Pin
Anton Mikhalyov19-Aug-05 7:06
Anton Mikhalyov19-Aug-05 7:06 
GeneralRe: __stdcall Pin
MailtoGops22-Aug-05 5:40
MailtoGops22-Aug-05 5:40 
GeneralAutomation: How do I select and copy text from a word document Pin
sammiantha18-Aug-05 7:31
sammiantha18-Aug-05 7:31 
GeneralRe: Automation: How do I select and copy text from a word document Pin
David Crow18-Aug-05 7:58
David Crow18-Aug-05 7:58 
GeneralRe: Automation: How do I select and copy text from a word document Pin
gamitech18-Aug-05 9:50
gamitech18-Aug-05 9:50 
GeneralRe: Automation: How do I select and copy text from a word document Pin
Garth J Lancaster18-Aug-05 19:20
professionalGarth J Lancaster18-Aug-05 19:20 
GeneralRe: Automation: How do I select and copy text from a word document Pin
sammiantha20-Aug-05 7:57
sammiantha20-Aug-05 7:57 
GeneralRe: Automation: How do I select and copy text from a word document Pin
sammiantha20-Aug-05 10:59
sammiantha20-Aug-05 10:59 
GeneralRe: Automation: How do I select and copy text from a word document Pin
Garth J Lancaster20-Aug-05 17:06
professionalGarth J Lancaster20-Aug-05 17:06 
GeneralRe: Automation: How do I select and copy text from a word document Pin
sammiantha21-Aug-05 21:00
sammiantha21-Aug-05 21:00 
GeneralRe: Automation: How do I select and copy text from a word document Pin
Garth J Lancaster21-Aug-05 21:11
professionalGarth J Lancaster21-Aug-05 21:11 
Generalconverting ebcdic to ascii Pin
Camron18-Aug-05 7:30
Camron18-Aug-05 7:30 
GeneralRe: converting ebcdic to ascii Pin
BlackDice18-Aug-05 7:38
BlackDice18-Aug-05 7:38 
GeneralRe: converting ebcdic to ascii Pin
David Crow18-Aug-05 7:51
David Crow18-Aug-05 7:51 

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.