|
Hello Everybody,
I too have a same problem.
[1]having a function ABC(arg1, arg2) in a dll that does not uses MFC.
[2]explicitly loading the dll (through LoadLibrary()).
[3]fetching the address of ABC() by using GetProcAddress(...) and storing it in appropriate function pointer.
[4]calling ABC() through the function pointer.
In DEBUG mode when control reaches the function pointer I get a MessageBox with following message :
The value of ESP was not properly saved across a function call.This is usually a result
of calling a function declared with no calling convention with a function pointer declared
with a different calling convention.
MessageBox does not appears in RELEASE mode.
Regards.
|
|
|
|
|
If it only happens in Debug mode and works correctly in Release then perhaps this compiler bug is causing it.
I believe it only effects VC2002 and VC2003.
http://support.microsoft.com/kb/822039[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Problem solved. !!! !!!
I declared function pointer in following way :
typedef int (_stdcall *PFUN_ABC) (arg1, arg2);
PFUN_ABC pFunABC = (PFUN_ABC) GetProcAddress(hDLL, "ABC");
pFunABC(arg1, arg2);
Now works fine in DEBUG and RELEASE.
Thanks.
Regards.
|
|
|
|
|
Try changing your calling convention.
See if this works:
extern "C" int __stdcall Adddata(void* item);
|
|
|
|
|
I am gettng
error LNK2001: unresolved external symbol __imp__function2@2
Trioum
|
|
|
|
|
Hi,
How could I get the context meno on Briefcase?
And how can I refresh the recycle bin after deleting all files from it?
|
|
|
|
|
pther wrote: How could I get the context meno on Briefcase?
Didn't I answer this last week? I thought I was even a little bit helpful.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hello dear friends,
I want to know How we can find the path of the file from the File handle?
Thanks in Advace.
ritz1234
|
|
|
|
|
try GetFinalPathNameByHandle.
-Saurabh
|
|
|
|
|
Hi Saurabh,
Thanks for the reply,
But it gives me errors
error C2065: 'GetFinalPathNameByHandle' : undeclared identifier
E:\Refrence Project Folder\TBHook\TBHook.cpp(106)
error C2065: 'VOLUME_NAME_NT' : undeclared identifier
I am using Visual Studio 6.0
Can you tell me what could be the reason?
Is it possible any other way?
ritz1234
|
|
|
|
|
It will work only in Vista.
If you want to get the file name in XP, you have to use NtQueryObject[^]. You have to dynamically load the function from ntdll.dll
|
|
|
|
|
ritz1234 wrote: But it gives me errors
ritz1234 wrote: Can you tell me what could be the reason?
Did you look at the Requirements section for this function in the documentation? It says:
Client Requires Windows Vista.
Server Requires Windows Server 2008.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
This [^] looks promising.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
ritz1234 wrote: File handle?
What do you mean by that?
Can you try to give us some kind of a clue? How did you create a file? Did you use CFile? Did you use C-Style FILE?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thanks for the reply friends,
Actually I've WH_CBT hook for my application.
That give me the handle of the file whenever the file is going to close
in the system.I want the path of the file to identify the file to which I
should concern.
Will let you know whose solution will work.
Thanks very much for helping.
ritz1234
|
|
|
|
|
ritz1234 wrote: Actually I've WH_CBT hook for my application.
That give me the handle of the file whenever the file is going to close
You mean your hook function will be called when ever user closes a file in that application . I never heared about that...
|
|
|
|
|
This hook is a system wide hook.
Whenever any file in the system is going to close the HCBT_DESTROYWND is
sent to the filter function of CBT_HOOK.
I want my application will be notified whenever any file in the system is
going to be closed.If you have any other solution, let me know.
ritz1234
|
|
|
|
|
ritz1234 wrote: Whenever any file in the system is going to close the HCBT_DESTROYWND is
HCBT_DESTROYWND is send to filter function, when ever a window is closed, not while Closing a file.
|
|
|
|
|
If any other information is there with you,Please forward it to me.
2 more question if possible.
1)
I've created the MFC extension DLL. My Idea is to whenever the filter
function notified the event of File Closed I want to find and copy the
path of the file in a variable, And there will be a function that returns
the path stored in the variable. What do you think?
2)
If I want to create the COM DLL instead of the MFC extension DLL,then I
have to add One CoClass in the DLL.In this CoClass I am thinking of
adding a function that installs the hook. For installing the hook I've to
use the SetWindowsHook function,In this function I've to Give the
HINSTANCE of the dll as the first argument. So the Question is How do I
provide my Coclass the HINSTANCE of the COM DLL.
ritz1234
|
|
|
|
|
ritz1234 wrote: And there will be a function that returns
the path stored in the variable. What do you think?
Its ok. Keep in mind that the variable should be kept in shared section.
ritz1234 wrote: So the Question is How do I
provide my Coclass the HINSTANCE of the COM DLL.
Why should you go for COM dll, while an ordinary dll will fit?
How ever I still remind you that, your hook function will not be called when ever a file is closed in an applicaiton . First check that, then only you need to think about further things..isnt it..
|
|
|
|
|
Thanks for the help buddy.
Actually I've tried using the variable that is global but not shared so
this doesn't give me the reuslt as expcted.So i've find out that I should
use the shared variable here.
Answer of your question.
1)I am going to use this DLL in the toolbar that will be developed next.
Because this is the MFC extension DLL I think It won't work with ATL.
That's why I think I have to write a COM dll that will Install,Uninstall
the hook. And will give me the path of the file that is closed upon
periodically calling this function. So seriously there is any way to use
HINSTANCE of COM DLL in CoClass?
ritz1234
|
|
|
|
|
ritz1234 wrote: Because this is the MFC extension DLL I think It won't work with ATL.
No need to worry, it will work..
|
|
|
|
|
Hi All,
Just like Sun certification Exams for JAVA. Is there any Certification Exam for VC++ Professionals conducted by Microsoft.
Please give me the Information about this.
|
|
|
|
|
G.L.Prasad wrote: Is there any Certification Exam for VC++ Professionals conducted by Microsoft.
No, not any more. They'll give out certificates only on .NET now.
If you have the skill, I don't think you will ever need such a certificate. But that's just my opinion.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: If you have the skill, I don't think you will ever need such a certificate. But that's just my opinion.
And having the certificate doesn't always imply you have the skills (but this is going on my arrogant...).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|